package com.netty.websocket;

import com.alibaba.fastjson.JSONObject;
import io.netty.channel.Channel;

public final class NettySession {
    private Channel channel;
    private String queue;
    private QueueType queueType;
    private JSONObject parameters;
    private String id;

    public NettySession(String id,Channel channel,String queue,QueueType queueType,JSONObject parameters) {
        this.id=id;
        this.channel=channel;
        this.queue=queue;
        this.queueType=queueType;
        this.parameters=parameters;
    }
    public String getId(){
        return id;
    }
    public String getUserd(){
        String userId = parameters.getString("userId");
        return userId==null?"":userId.trim();
    }

    public JSONObject parameters(){
        return parameters;
    }
    public Channel channel(){
        return channel;
    }
    public String getSessionId(){
        String sessionId =parameters.getString("sessionId");
        return sessionId==null?"":sessionId;
    }

//    public boolean getIsComsumer(){
//        return parameters.getBoolean("isComsumer");
//    }
//    public boolean getIsRecvSingle(){
//        return parameters.getBoolean("isRecvSingle");
//    }
    public String getQueue(){
        return this.queue;
    }
    public QueueType getQueueType(){
        return this.queueType;
    }
}